package com.quartz2.jobs;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.tmpt.service.IQuartzService;
import com.quartz2.manager.AutoJobDTO;
  
//@DisallowConcurrentExecution//有状态的任务需要加上这个注解  
public class ProcedureJobAction implements Job {  
  
	@Resource
	IQuartzService quartzService;
	
    @Override  
    public void execute(JobExecutionContext arg0) throws JobExecutionException {  
        //.out.println("任务成功运行------");
        AutoJobDTO jobDto = (AutoJobDTO)arg0.getMergedJobDataMap().get("scheduleJob");  
        //.out.println("任务名称 = [" + jobDto.getJob_name()+ "]");
        
		//动态调用bean
        Map<String,Object> paramMap = new HashMap<String, Object>();
        quartzService.executeProcedureJob(jobDto.getProcedure(),paramMap);

    }  
  
}  